const app = getApp();

Component({
  properties: {
    params: {
      type: Object,
      value: {}
    }
  },
  data: {
    login: false
  },
  ready() {
    const {
      margin,
      column,
      size,
      style,
      background,
      color,
      images
    } = this.properties.params
    
    this.setData({
      margin: margin,
      column: column,
      size: size,
      style: style,
      background: background,
      color: color,
      images: images
    });
  },
  methods: {
    redirect(event) {
      if (app.login()) {
        app.redirect(event.currentTarget.dataset.link);
      } else {
        if (event.currentTarget.dataset.login == false) {
          app.redirect(event.currentTarget.dataset.link);
        } else {
          this.setData({ login: true });
        }
      }
    }
  }
})